package com.yupi.yupicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.yupi.yupicturebackend.model.dto.picture.*;
import com.yupi.yupicturebackend.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.yupicturebackend.model.entity.User;
import com.yupi.yupicturebackend.model.vo.PictureVO;
import org.springframework.scheduling.annotation.Async;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
* @author Y9000
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-09-17 13:54:43
*/
public interface PictureService extends IService<Picture> {


    //上传图片
    PictureVO uploadPicture(Object inputSource, PictureUploadRequest pictureUploadRequest, User loginUser) throws IOException;



    // 获取查询条件
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);


    //补充审核参数 审核照片参数设置
    void fillReviewParams(Picture picture, User loginUser);

    /**
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return
     */
    //图片上传
    Integer uploadPictureByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest, User loginUser);



    //删除cel
    @Async
    void clearPictureFile(Picture oldPicture);

    /**
     * 校验图片
     *
     * @param picture
     */
    void validPicture(Picture picture);
    /**
     * 获取图片包装类（单条）
     *
     * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 获取图片包装类（分页）
     *
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);


    //图片审核
    void doPictureReview(PictureReviewRequest pictureReviewRequest,User loginUser);


    void deletePicture(Long pictureId, User loginUser);

    //编辑图片
    void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

    void checkSpaceAuth(User loginUser, Picture picture);

    //根据颜色搜索图片
    List<PictureVO> searchPictureByColor(Long spaceId, String picColor, User loginUser);

    boolean editPictureBatch(PictureEditByBatchRequest pictureEditBatchRequest, User loginUser);


//    void checkPictureAuth(User loginUser, Picture picture);
}
